package com.plian.system.wrapper.fr.bonds;

import com.plian.system.dto.fr.bonds.ExistBondsDTO;
import com.plian.system.entity.fr.bonds.ExistBonds;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.fr.bonds.ExistBondsVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.*;

/**
 * @description:
 * @author: gangan
 * @create: 2020-04-23 14:14
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface ExistBondsWrapper extends BaseWrapper<ExistBonds, ExistBondsDTO, ExistBondsVO> {

    /**
     * Entity转VO
     *
     * @param entity /
     * @return /
     */
    @Override
    @Mappings(value = {
            @Mapping(source = "groupCompany", target = "groupCompanyName", qualifiedByName = ORG_ID_TO_NAME),
            @Mapping(source = "issuer", target = "issueName", qualifiedByName = ORG_ID_TO_NAME),
            @Mapping(source = "orgId", target = "orgName", qualifiedByName = ORG_ID_TO_NAME),
            @Mapping(source = "createUser", target = "createUserName", qualifiedByName = USER_ID_TO_NAME),
            @Mapping(source = "updateUser", target = "updateUserName", qualifiedByName = USER_ID_TO_NAME),
    })
    ExistBondsVO entityToVO(ExistBonds entity);

}
